# read file and create dict
file = open("university1.txt","rt")
tables = file.readlines()
table = {}
for line in tables:
    province,*nums = line.split()
    province.strip()
    nums = list(map(int,nums))
    #print(province,nums)
    table[province] = nums 
'''
# retrive
dname = input()
name = name.strip()
print(f"{name}大学数量：{table[name][0]}，双一流高校建设数量：{table[name][1]}，一流大学建设高校数量：{table[name][2]}，一流学科建设高校数量：{table[name][3]}。") 
'''
# sort by two column
ltable = list(table.items())
ltable.sort(key=lambda x:(x[1][1],x[1][2]),reverse = True)
for i in ltable:
    print(i[0],i[1])

# statistical
sum1 = 0;
sum2 = 0;
for line in table:
    sum1 += table[line][1]
    sum2 += table[line][2]
print(f"Double first class universities = {sum1};First class universities = {sum2}")
